﻿using NPOI.HSSF.Util;

namespace AutoTest.Common.ExcelExport
{
    /// <summary>
    /// 
    /// </summary>
    /// <remarks>
    /// 构造函数
    /// </remarks>
    /// <param name="headerName"></param>
    [AttributeUsage(AttributeTargets.Property)]
    public class ExportHeaderAttribute(string headerName) : Attribute
    {

        /// <summary>
        /// 
        /// </summary>
        public EnumFirstHeaderStyle FirstRowStyle { get; set; } = EnumFirstHeaderStyle.CurrentRow;
        /// <summary>
        /// 主标题
        /// </summary>
        public string TopHeaderName { get; set; } = string.Empty;
        /// <summary>
        /// 副标题（只有一个标题，副标题不赋值，如果有副标题，则主标题保持一致，用于分组）
        /// </summary>
        public string HeaderName { get; set; } = headerName;
        /// <summary>
        /// 距离开始列的偏移列,从1开始计数
        /// </summary>
        public int? DeviationCol { get; set; }

        /// <summary>
        /// 占多少列（如果占有多列，则根据副标题的数量
        /// </summary>
        public int Colspan { get; set; } = 0;

        /// <summary>
        /// 占多少行
        /// </summary>
        public int Rowspan { get; set; } = 0;

        /// <summary>
        /// 内容
        /// </summary>
        public string Content { get; set; } = string.Empty;

        /// <summary>
        /// 数据格式
        /// </summary>
        public string DataFormat { get; set; } = "";

        /// <summary>
        /// 单元格类型
        /// </summary>
        public ColumnType ColumnType { get; set; } = ColumnType.Text;
        /// <summary>
        /// 单元格颜色
        /// </summary>
        public short? BackgroundColor { get; set; } = HSSFColor.DarkBlue.Index;

        /// <summary>
        /// 字体颜色
        /// </summary>
        public short? FontColor { get; set; } = HSSFColor.White.Index;
    }

    /// <summary>
    /// 忽略导出字段属性
    /// </summary>
    /// <remarks>
    /// 
    /// </remarks>
    /// <param name="ignore"></param>
    [AttributeUsage(AttributeTargets.Property)]
    public class ExportIgnoreAttribute(bool ignore = true) : Attribute
    {
        /// <summary>
        /// 
        /// </summary>
        public bool Ignore { get; set; } = ignore;
    }
}
